package week4;

import javax.swing.*;
import java.awt.*;

public class PaintTable {
    public static void main(String[] args) {
        JFrame jf = new JFrame();

        class MyPaitnerPanel extends JPanel {
            @Override
            public void paint(Graphics g) {
                super.paint(g);
                g.setColor(Color.PINK);
                int x = 30, y = 30;
                int height = 400;
                int wx = 40;
                g.drawRect(x, y, height, height);

                for (int i = 1; i < 10; i++) {
                    g.drawLine(x + i * wx, y, x + i * wx, y + height);//起点，终点
                    g.drawLine(x, y + i * wx, x + height, y + i * wx);
                }

            }
        }

        jf.add(new MyPaitnerPanel());

        jf.setVisible(true);
        jf.setLocationRelativeTo(null);
        jf.setSize(600, 600);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
